build: Use get_pkgconfig_variable()
authorEmmanuele Bassi <ebassi@gnome.org>
Wed, 26 Apr 2017 16:10:15 +0000 (17:10 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Wed, 3 May 2017 14:10:57 +0000 (15:10 +0100)
There's no need to run pkg-config ourselves.

gtk/meson.build
modules/input/meson.build

index a948d069a9987bf7ea744adb91ba88e0fd006d7f..02c352fb4da213b48998e96937c806bb308c8458 100644 (file)
@@ -811,22 +811,15 @@ gtk_deps = [
   atk_dep,
   epoxy_dep,
   libm,
-  graphene_dep
+  graphene_dep,
 ]
 
 if x11_enabled
-  runcmd = run_command('pkg-config', '--variable=prefix', 'x11')
-  if runcmd.returncode() == 0
-      gtk_cargs += '-DX11_DATA_PREFIX="' + runcmd.stdout().strip() + '"'
-  else
-    error('Could not get x11 data prefix via pkg-config.')
-  endif
+  x11_data_prefix = dependency('x11').get_pkgconfig_variable('prefix')
 
+  gtk_cargs += [ '-DX11_DATA_PREFIX="@0@"'.format(x11_data_prefix), ]
   gtk_sources += gtk_x11_sources
-  gtk_deps += [
-    xi_dep,
-    x11_dep,
-  ]
+  gtk_deps += [ xi_dep, x11_dep, ]
 endif
 
 if wayland_enabled
index 43c32621659476a2b7db90413449727740cc362c..0111790c73059cf0cbb88dd1e254dc9e987fe3d6 100644 (file)
@@ -8,21 +8,26 @@
 build_dynamic_modules = false
 disable_modules = get_option('disable-modules')
 if not disable_modules
-  runcmd = run_command('pkg-config', '--variable=gmodule_supported', 'gmodule-no-export-2.0')
-  if runcmd.returncode() == 0
-    gmodule_supported = runcmd.stdout().strip()
-    if gmodule_supported == 'true'
-      build_dynamic_modules = true
-    else
-      message('Modules are not supported according to gmodule-no-export-2.0.pc')
-    endif
+  gmodule_supported = dependency('gmodule-no-export-2.0').get_pkgconfig_variable('gmodule_supported')
+  if gmodule_supported == 'true'
+    build_dynamic_modules = true
   else
-    message('WARNING: failed to query if modules are supported!')
+    message('Modules are not supported according to gmodule-no-export-2.0.pc')
   endif
 endif
 
-all_immodules = ['am-et', 'cedilla', 'cyrillic-translit', 'inuktitut',
-                 'ipa', 'multipress', 'thai', 'ti-er', 'ti-et', 'viqr']
+all_immodules = [
+  'am-et',
+  'cedilla',
+  'cyrillic-translit',
+  'inuktitut',
+  'ipa',
+  'multipress',
+  'thai',
+  'ti-er',
+  'ti-et',
+  'viqr',
+]
 
 all_immodules += backend_immodules